<?php

    // Author: 阿茵Ayin
    // Data: 2021.10.23 15:35
    
    // Create a mysql connection
    function createSQLConnection($username, $password, $servername) {
        
        //$conn = new mysqli($servername, $username, $password);
        $conn = mysqli_connect($servername, $username, $password) or die("Unable to connect to the MySQL!");

        if($conn->connect_error) {

            echo(mysqli_connect_error());
            return null;
        }

        return $conn;
    }

    //  Close a mysql connection
    function closeSQLConnection($connection) {

        $connection->close();
    }

    // Select a database
    function selectDB($connection, $databaseName) {

        mysqli_select_db($connection, $databaseName);
    }

?>